package com.chezai.client.bean;

import com.chezai.client.dao.ClassRecordDao;
import com.chezai.client.dao.DaoSession;
import com.chezai.client.dao.UserInfoDao;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToOne;

/**
 * 科一科四学员签到签退，类
 * Created by likunyang on 2017/8/24.
 */

@Entity
public class ClassRecord {

    public static final int SIGN_IN = 1;//已签到
    public static final int SIGN_OUT = 2;//已签退
    @Id(autoincrement = true)
    private Long _ID;
    /**
     * 创建时间 yyyy/MM/dd
     */
    private String createTime;
    /**
     * 签到时间 HH:mm
     */
    private Long signInTime;
    /**
     * 签退时间 HH:mm
     */
    private Long signOutTime;
    /**
     * 课程ID
     */
    private Long classId;
    /**
     * courseId 课堂编号
     */
    private String courseNum;
    /**
     * 学员签到状态
     * 1已签到
     * 2已签退
     */
    private int signStatus;
    /**
     * 培训部分
     */
    private int trainPart;
    /**
     * 培训项目
     */
    private String trainSubject;
    /**
     * 训练有效时长 单位:s
     */
    private long studyValidLong;
    /**
     * 训练里程 单位:m
     */
    private int mileage;

    private Long sid;
    @ToOne(joinProperty = "sid")
    private UserInfo userInfo;
    /**
     * Used to resolve relations
     */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /**
     * Used for active entity operations.
     */
    @Generated(hash = 1800567932)
    private transient ClassRecordDao myDao;
    @Generated(hash = 2066097151)
    private transient Long userInfo__resolvedKey;

    @Generated(hash = 332326764)
    public ClassRecord(Long _ID, String createTime, Long signInTime,
                       Long signOutTime, Long classId, String courseNum, int signStatus,
                       int trainPart, String trainSubject, long studyValidLong, int mileage,
                       Long sid) {
        this._ID = _ID;
        this.createTime = createTime;
        this.signInTime = signInTime;
        this.signOutTime = signOutTime;
        this.classId = classId;
        this.courseNum = courseNum;
        this.signStatus = signStatus;
        this.trainPart = trainPart;
        this.trainSubject = trainSubject;
        this.studyValidLong = studyValidLong;
        this.mileage = mileage;
        this.sid = sid;
    }

    @Generated(hash = 2042156977)
    public ClassRecord() {
    }

    public Long get_ID() {
        return this._ID;
    }

    public void set_ID(Long _ID) {
        this._ID = _ID;
    }

    public String getCreateTime() {
        return this.createTime == null ? "" : this.createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public Long getSignInTime() {
        return this.signInTime;
    }

    public void setSignInTime(Long signInTime) {
        this.signInTime = signInTime;
    }

    public Long getSignOutTime() {
        return this.signOutTime;
    }

    public void setSignOutTime(Long signOutTime) {
        this.signOutTime = signOutTime;
    }

    public Long getClassId() {
        return this.classId;
    }

    public void setClassId(Long classId) {
        this.classId = classId;
    }

    public String getCourseNum() {
        return this.courseNum;
    }

    public void setCourseNum(String courseNum) {
        this.courseNum = courseNum;
    }

    public int getSignStatus() {
        return this.signStatus;
    }

    public void setSignStatus(int signStatus) {
        this.signStatus = signStatus;
    }

    public int getTrainPart() {
        return this.trainPart;
    }

    public void setTrainPart(int trainPart) {
        this.trainPart = trainPart;
    }

    public String getTrainSubject() {
        return this.trainSubject;
    }

    public void setTrainSubject(String trainSubject) {
        this.trainSubject = trainSubject;
    }

    public long getStudyValidLong() {
        return this.studyValidLong;
    }

    public void setStudyValidLong(long studyValidLong) {
        this.studyValidLong = studyValidLong;
    }

    public int getMileage() {
        return this.mileage;
    }

    public void setMileage(int mileage) {
        this.mileage = mileage;
    }

    public Long getSid() {
        return this.sid;
    }

    public void setSid(Long sid) {
        this.sid = sid;
    }

    /**
     * To-one relationship, resolved on first access.
     */
    @Generated(hash = 588869807)
    public UserInfo getUserInfo() {
        Long __key = this.sid;
        if (userInfo__resolvedKey == null || !userInfo__resolvedKey.equals(__key)) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            UserInfoDao targetDao = daoSession.getUserInfoDao();
            UserInfo userInfoNew = targetDao.load(__key);
            synchronized (this) {
                userInfo = userInfoNew;
                userInfo__resolvedKey = __key;
            }
        }
        return userInfo;
    }

    /**
     * called by internal mechanisms, do not call yourself.
     */
    @Generated(hash = 1436065665)
    public void setUserInfo(UserInfo userInfo) {
        synchronized (this) {
            this.userInfo = userInfo;
            sid = userInfo == null ? null : userInfo.get_ID();
            userInfo__resolvedKey = sid;
        }
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /**
     * called by internal mechanisms, do not call yourself.
     */
    @Generated(hash = 769504768)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getClassRecordDao() : null;
    }


}
